<template>
  <view>
    <swiper autoplay :style="{height: height}" :indicator-dots="true">
      <swiper-item :style="{height: height}" v-for="(item,index) in list" :key="index">
        <view class="flex align-center justify-center">
					<u-image borderRadius="20" :src="item.image" width="685rpx" :height="height" @click="toPage(item)"></u-image>
        </view>
      </swiper-item>
    </swiper>
  </view>
</template>

<script>
  export default {
    name: "dy-swiper",
    props: {
      list: {
        type: Array,
        default () {
          return []
        }
      },
			height: {
				type: String,
				default: '300rpx'
			}
    },
    methods: {
			toPage(item) {
				console.log(item);
				if(item.type == 2) {
					uni.navigateTo({
					  url:'/pages/goodsDetail/commonGoodsDetail/commonGoodsDetail?goods_id='+ item.goods_url
					})
				}
				if(item.type == 1) {
					uni.navigateTo({
					  url:'/pages/goodsDetail/goodsBannerInfo/goodsBannerInfo?item='+ JSON.stringify(item)
					})
				}
			}
		}
  }
</script>

<style lang="scss" scoped>
  .image {
    width: 100%;
    height: 300rpx;
  }

  ::v-deep .u-swiper-image {
    border-radius: 20rpx;
  }
</style>
